const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/db');

const AIRole = sequelize.define('AIRole', {
  name: {
    type: DataTypes.STRING,
    allowNull: false
  },
  description: {
    type: DataTypes.TEXT,
    allowNull: true
  },
  avatar: {
    type: DataTypes.STRING,
    allowNull: true
  },
  type: {
    type: DataTypes.STRING(255),
    defaultValue: 'assistant'
  },
  api_provider: {
    type: DataTypes.STRING,
    allowNull: false
  },
  api_config: {
    type: DataTypes.JSON,
    allowNull: true
  },
  system_prompt: {
    type: DataTypes.TEXT,
    allowNull: true,
    comment: '系统提示词，用于指导AI角色的行为和风格'
  },
  created_at: {
    type: DataTypes.DATE,
    defaultValue: DataTypes.NOW
  }
}, {
  timestamps: false
});

module.exports = AIRole;